home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 28 / 028.d81 / loan calc (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  7KB  |  204 lines

  1. 1 dimg$(75)
  2. 5 def fnr(x)=int(100*x+.5)/100:bk$="[164]":printchr$(142);
  3. 7 gosub600
  4. 10 print"[147][129] loan calculator "
  5. 20 print"no. of months:    [157][157][157][157]";bk$;:mo=2:nc=4:gosub60500:n=val(a$)
  6. 30 ifval(a$)=.thenprint"[145][145][145][145][145]";:goto20
  7. 60 print"interest rate %:     [157][157][157][157][157]";bk$;:mo=130:nc=5:gosub60500:ar=val(a$)
  8. 70 ifval(a$)=.thenprint"[145][145][145]";:goto60
  9. 80 mr=ar/1200
  10. 90 print"principal:               [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";bk$;:nc=15:gosub60500
  11. 95 p=val(a$):ifval(a$)=.thenprint"[145][145][145]";:goto90
  12. 96 print"month of first pmt (1 to 12):  [157][157]";bk$;:mo=2:nc=2:gosub60500
  13. 97 mt=val(a$):ifval(a$)<1orval(a$)>12thenprint"[145][145]";:goto96
  14. 98 print"year of 1st payment:    [157][157][157][157]";bk$;:mo=2:nc=4:gosub60500:yr=val(a$)
  15. 99 ifval(a$)=.thenprint"[145][145][145]";:goto98
  16. 100 pmt=(p*mr)/(1-(1+mr)^(-n))
  17. 105 pmt=fnr(pmt)
  18. 110 print"payment=",fnr(pmt)
  19. 111 print"press return key once"
  20. 112 print"to continue and again to pause":mo=mt
  21. 113 geta$:if a$=""        then113
  22. 115 print"[147]pmt #   int amt    prin amt     bal due "
  23. 120 ta=0:tb=0:k=0:np=p:ny=yr
  24. 125 for i=1ton
  25. 132 geta$:ifa$=""then140
  26. 134 geta$:ifa$<>""then134
  27. 136 geta$:ifa$=""then136
  28. 140 ip=np*mr
  29. 145 pp=pmt-fnr(ip)
  30. 150 np=np-pp
  31. 155 ai=ai+ip
  32. 160 ifi=nthenpp=pp+np:np=0.00
  33. 162 cp=cp+pp
  34. 165 print i;tab(8);fnr(ip);tab(18);fnr(pp);tab(29);fnr(np)
  35. 167 ifi=nthenprint"final payment=";fnr(pp+ip)
  36. 170 ta=ta+fnr(ip):rem accumulates int.pd.
  37. 175 tb=tb+fnr(pp):rem accumulates prin. pd.
  38. 177 ifi=n+1then215
  39. 180 ifi=13-mothengosub800:goto210
  40. 185 k=k+1:ifk=12thengosub800
  41. 210 nexti
  42. 215 gosub800
  43. 220 print"[147] f1 [146] to see again    f5 [146] to quit"
  44. 230 print" f3 [146] to do another   f7 [146]  printed copy"
  45. 235 getb$:ifb$=""then235
  46. 240 ifb$="[133]"then300:rem f1
  47. 250 ifb$="[134]"thenclr:goto5:rem f3
  48. 260 ifb$="[135]"then60000
  49. 270 ifb$="[136]"then400
  50. 280 goto235
  51. 300 np=p:ai=0:ny=yr:cp=0:goto110
  52. 400 rem data to printer
  53. 405 print"[147][129] send to printer "
  54. 410 print"is printer on and ready?"
  55. 415 print"name of this document (75 char limit)":print
  56. 420 print"=>";bk$;:nc=75:qq=mo:mo=190:gosub60500:f$=a$:mo=qq
  57. 425 iflen(f$)>75thenprint"[144]name too long, try again[156]":goto420
  58. 430 open15,4,15:close15:ifst=0then439
  59. 432 print"hold on, your printer isn't online!"
  60. 434 print"check the cables and try it again."
  61. 435 print"press [return].
  62. 436 [161]a$:[139]a$[179][177][199](13)[167]436
  63. 437 [137]220
  64. 439 [153]"hold on while i talk to the printer."
  65. 440 [159]1,4
  66. 445 [157]1
  67. 450 [152]1,f$
  68. 455 [152]1,"monthly payment: ";pmt;[199](16)"30amount of loan: ";p
  69. 460 [152]1," pmt #     interest pmt      principal pmt      balance due"
  70. 462 ta[178]0:tb[178]0:k[178]0:np[178]p
  71. 463 cp[178]0:ai[178]0:ny[178]yr
  72. 465 [129]i[178]1[164]n
  73. 470 ip[178]np[172]mr
  74. 475 pp[178]pmt[171][165]r(ip)
  75. 480 np[178]np[171]pp
  76. 485 ai[178]ai[170]ip
  77. 490 [139]i[178]n[167]pp[178]pp[170]np:np[178]0
  78. 492 cp[178]cp[170]pp
  79. 495 [152]1,i;[199](16)"10";[165]r(ip);[199](16)"30";
  80. 496 [152]1,[165]r(pp);[199](16)"50";[165]r(np)
  81. 497 [139]i[178]n[167][152]1,"final payment=";[165]r(pp[170]ip)
  82. 500 ta[178]ta[170][165]r(ip):[143] accumulates int pd.
  83. 505 tb[178]tb[170][165]r(pp):[143] accumulates prin pd.
  84. 507 [139]i[178]n[167]540
  85. 510 [139]i[178]13[171]mt[167][141]900:[137]530
  86. 520 k[178]k[170]1:[139]k[178]12[167][141]900
  87. 530 [130]i
  88. 540 [141]900
  89. 550 [160]1:l[178]0:[153]"load":[137]220
  90. 600 [143] title
  91. 605 [151]53281,15:[151]53280,11
  92. 610 [153]"load(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)"
  93. 615 [153]"(NULL)(NULL)(NULL)(NULL)(NULL) loan  calculator wait(NULL)(NULL)(NULL)(NULL)(NULL)"
  94. 620 [153]"(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)(NULL)"
  95. 625 [153]"this program will calculate loans and"
  96. 630 [153]"mortgages and make a printout on paper."
  97. 635 [153]"the printer program is written to skip"
  98. 640 [153]"15 lines from one sheet to another when"
  99. 645 [153]"using the 1525 printer. this may have"
  100. 650 [153]"to be changed for other printers. see"
  101. 655 [153]"lines 950 and 980."
  102. 657 [153]"just follow the simple instructions"
  103. 660 [153]"given by the prompts.stop  (hit any key)"
  104. 690 [161]a$:[139]a$[178]""[167]690
  105. 695 [142]
  106. 800 [153]"totototototototototototototototototototototototototototototototototototototototo"
  107. 810 [153]"ontotalswait":[153]"yr";ny:ny[178]ny[170]1
  108. 840 [153]"on"[163]8);ta;[163]18);tb
  109. 845 [153]"accum"[163]8);[165]r(ai);[163]18);[165]r(cp)
  110. 850 [153]" press [return] to continue, q to quit"
  111. 855 [161]a$:[139]a$[178][199](13)[167]858
  112. 856 [139]a$[178]"q"[176]a$[178]"(NULL)"[167]220
  113. 857 [137]855
  114. 858 [153]"on                                       "
  115. 860 ta[178]0:tb[178]0:k[178]0
  116. 870 [153]"pmt #   int amt   prin amt     bal due  "
  117. 880 [142]
  118. 900 [152]1,"---------------------------";
  119. 905 [152]1,"--------------------------------------"
  120. 910 [152]1," totals wait"
  121. 920 [152]1,ny;[199](16)"10";ta;[199](16)"30";tb
  122. 930 [152]1,"accum";[199](16)"10";[165]r(ai);[199](16)"30";[165]r(cp)
  123. 935 [152]1,"---------------------------";
  124. 937 [152]1,"--------------------------------------"
  125. 940 ny[178]ny[170]1
  126. 950 l[178]l[170]1:[139]l[178]3[176]l[178]6[176]l[178]9[176]l[178]12[176]l[178]15[176]l[178]18[176]l[178]21[176]l[178]24[176]l[178]27[167][141]980
  127. 955 ta[178]0:tb[178]0:k[178]0
  128. 960 [142]
  129. 980 [129]s[178]1[164]15:[152]1:[130]
  130. 990 [152]1," pmt #     interest pmt      principal pmt      balance due"
  131. 995 [142]
  132. 60000 [159]15,8,15,"r0:hello connect=hello connect"
  133. 60005 [132]15,er:[160]15:[139]er[179][177]63[167][128]
  134. 60010 [153]"load";:[147]"hello connect",8
  135. 60100 pn$[178]"(NULL)(NULL)atn(NULL) lenatn(NULL)len(NULL)(NULL)atn(NULL)(NULL)(NULL)":an$[178]"peek(NULL):  (NULL). (NULL). (NULL)val(NULL)(NULL)(NULL)(NULL)"
  136. 60110 bo[178]02:sc[178]10:cl[178]06:c1[178]05:c2[178]02:c3[178]05:c4[178]02:c5[178]00:c6[178]00:c7[178]00
  137. 60120 [143] bo - border color
  138. 60121 [143] sc - screen color
  139. 60122 [143] cl - color poked on border
  140. 60123 [143] c1 - top box outside color
  141. 60124 [143] c2 - top box inside color
  142. 60125 [143] c3 - bottom box outside color
  143. 60126 [143] c4 - bottom box inside color
  144. 60127 [143] c5 - 'copyright' color
  145. 60128 [143] c6 - 'program name' color
  146. 60129 [143] c7 - 'authors name' color
  147. 60130 [151]53280,bo:[151]53281,sc:[153]"load";
  148. 60140 [151]646,c1:[153]"  totototototototototototototototototototototototototototototototototototo"
  149. 60150 [151]646,c2:[153]"  fn        (NULL)(NULL)atnstr$(NULL)(NULL)atn(NULL) (NULL)(NULL)val(NULL)val(NULL)(NULL)(NULL):        then"
  150. 60170 [151]646,c1:[153]"  tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab("
  151. 60180 [151]646,c6:[153]""[163]20[171][195](pn$)[173]2);pn$
  152. 60190 [151]646,c7:[153]""[163]20[171][195](an$)[173]2);an$
  153. 60200 [151]646,c5:[153]""[163]13)"len(NULL)(NULL)(NULL)(NULL)right$chr$left$(NULL) 1986"
  154. 60210 [153][163]9)"len(NULL)(NULL)(NULL)(NULL)str$(NULL)(NULL)val (NULL)(NULL)peek(NULL)right$lenatn(NULL)right$(NULL)(NULL)(NULL)"
  155. 60220 [151]646,c3:[153]"  totototototototototototototototototototototototototototototototototototo"
  156. 60230 [151]646,c4:[153]"  fn                                  then"
  157. 60240 [151]646,c3:[153]"  tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(tab(":le[178]1044:ri[178]1043
  158. 60250 [151]le,98:[151]ri,98:le[178]le[171]1:ri[178]ri[170]1
  159. 60260 co[178]54272:[151]ri[170]co,cl:[151]le[170]co,cl
  160. 60270 [139]le[178]1025[167]60290
  161. 60280 [137]60250
  162. 60290 [151]le,108:[151]ri,123:[151]le[170]co,cl:[151]ri[170]co,cl:[151]646,cl
  163. 60300 le[178]le[170]40:ri[178]ri[170]40:[139]le[178]1985[167]60330
  164. 60305 [139]le[178]1185[167][153]"usrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusr"
  165. 60306 [139]le[178]1825[167][153]"andandandandandandandan